<?php  include VIEWPATH.'common/head.php';  ?>
    <script type="text/javascript">
        var status = '<?php echo $_GET['status'];?>';
        if(status == '-1'){
            alert('fail:<?php echo $_GET['msg'];?>');
        }
        function del_up_img(img_id){
            if(confirm("确定删除吗？")){
                var url = 'index.php?c=imgList&m=del_up_img&id='+img_id;
                var param = {};
                common_ajax(url, param, function(data){
                    if(data.errorCode == 0) {
                        //表单提交
                        window.location.href = window.location.href;
                        return;
                    }else{
                        console.log(data.errorMsg);
                        alert(data.errorMsg);
                    }
                });
            }
        }
    </script>
    <body class="gray-bg">
    <div class="wrapper wrapper-content ">
        <div class="add-btn" style="float:right;margin-bottom:5px;">
            <div class="modal fade" id="add_img" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
                <div class="modal-dialog" style="width: 60%;"><div class="modal-content"></div></div>
            </div>
        </div>
        <div class="clearfix"></div>

        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <div class="ibox-tools">
                            <a class="collapse-link">
                                <i class="fa fa-chevron-up"></i>
                            </a>
                            <a class="close-link">
                                <i class="fa fa-times"></i>
                            </a>
                        </div>
                    </div>
                    <div class="ibox-content">

                        <form class="form-horizontal" id="f_form" action="index.php?c=<?php echo $_REQUEST['c'];?>&m=<?php echo $_REQUEST['m'];?>" name="form" method="post">
                            <div class="form-group">
                                <div class="text-right col-sm-2">
                                    <label class="control-label">图片标签：</label>
                                </div>
                                <div class="col-sm-2">
                                    <select name="tag_id" class="form-control">
                                        <option value="">全部</option>
                                        <?php
                                        foreach($tag as $k => $v){ ?>
                                            <option value="<?php echo $v['id'];?>"  <?php echo $v['id'] == $_REQUEST["tag_id"] ? 'selected' : '';?>><?php echo $v['title'];?></option>
                                        <?php } ?>
                                    </select>
                                </div>

                                <div class="col-sm-1">
                                    <button class="btn btn-sm btn-primary" type="submit"> 搜索 </button>
                                </div>
                            </div>
                        </form>
                        <div class="post_list">
                            <div class="table-data-list">
                                <form name="form" class="form" action="index.php?c=<?php echo $_REQUEST['c']; ?>&m=<?php echo $_REQUEST['m'];?>" method="post">
                                    <table class="table">
                                        <thead>
                                        <tr class="active">
<!--                                            <th><input type="checkbox" name="chkall" onclick="checkAll('prefix', this.form, 'id')" class="checkbox"></th>-->
                                            <th nowrap="nowrap">图片</th>
                                            <th nowrap="nowrap">标签</th>
                                            <th>图片地址</th>
                                            <th nowrap="nowrap">宽高</th>
                                            <th nowrap="nowrap">上传时间</th>
                                            <th></th>
                                        </tr>
                                        </thead>
                                        <tbody>
                                        <?php foreach($list as $img){
                                            ?>
                                            <tr>
<!--                                                <td><input type="checkbox" class="checkbox" name="id[]" value="--><?php //echo $img['id'];?><!--"/></td>-->
                                                <td>
                                                    <?php
                                                    $w=$img['w']>$img['h']?100:'';
                                                    $h=$img['h']>$img['w']?100:'';
                                                    $w=$img['w']==$img['h']?100:$w;
                                                    ?>
                                                        <img src="<?php echo $img["path"];?>?x-oss-process=style/scale-cade2" width='<?php echo $w?>px'  height='<?php echo $h;?>px' >

                                                </td>
                                                <td nowrap="nowrap"><?php echo $img['title'];?></td>
                                                <td><input type="text" value="<?php echo  $img["path"];?>" class="form-control col-sm-12"/></td>
                                                <td nowrap="nowrap"><?php echo "宽:".$img["w"]."; 高:".$img["h"];?></td>
                                                <td nowrap="nowrap"><?php echo date("Y-m-d H:i:s", $img["add_time"]);?></td>
                                                <td nowrap="nowrap">
                                                    <a href="javascript:void(0)" onclick="del_up_img(<?php echo $img['id'];?>)">删除</a>
                                                </td>
                                            </tr>
                                        <?php } ?>
                                        </tbody>
                                    </table>
                                </form>
                            </div>
                            <div class="set_page">
                                <?php echo $multipage; ?>
                                <div class="clearfix"></div>
                            </div>

                        </div>

                    </div>
                </div>
            </div>

        </div>


    </div>
    <script src="http://gosspublic.alicdn.com/aliyun-oss-sdk-4.4.4.min.js"></script>
<?php  include VIEWPATH.'common/footer.php';  ?>